<? session_start(); ?>

<?php  if ( count($_SESSION['daySoLuong'])<=0) { ?>


<p>Bạn chưa đặt tour nào</p>
<?php } else { ?>

<table width="500" border="0"  align="center" cellpadding="3" cellspacing="1">
<tr id="caption_giohang"> <th width="308">TÊN TOUR</th> 
<th width="80">SL</th> 
<th width="90">TIỀN</th> </tr>

<!-- bắt đầu lặp -->
<?php 
$sosp = count($_SESSION['daySoLuong']);
reset($_SESSION['daySoLuong']);
reset($_SESSION['dayDonGia']);
reset($_SESSION['dayTenSP']);
$tongtien=0; $tongsoluong=0;
for ($i = 0; $i<$sosp ; $i++) {
	$idTin = key($_SESSION['daySoLuong']); //
	$tensp = current($_SESSION['dayTenSP']);
	$soluong = current($_SESSION['daySoLuong']);
	$dongia = current($_SESSION['dayDonGia']);
	$tien = $dongia*$soluong;
	$tongtien+= $tien;
	$tongsoluong+= $soluong;
?>
<tr class="row2">
      <td> <? echo $tensp;?> </td>
      <td>
      
      <form action="" method="get" id="formUpdate" style= "margin:0">
        <input name="soluong" id="soluong" value="<?php echo $soluong;?>" size="1"/>
        <img src="images/refresh.gif" class="capnhatsoluong" idTin="<? echo $idTin;?>"/>
        <img src="images/remove.gif" class="removesp" idTin="<? echo $idTin;?>"/>      
       </form>      </td>
      <td> 
      <div align="center">
	  	<?php
			if($tien==0) echo $tien = 'Liên hệ'; 
			else
				echo $tien;
		?> 
      </div>
      </td>
</tr>

<?php
 next($_SESSION['daySoLuong']);
 next($_SESSION['dayDonGia']);
 next($_SESSION['dayTenSP']);	
}  //for
?>

<!--kết thúc lặp -->

<tr class="tongket">
<th>Tổng</th><th id="tsl"> <? echo $tongsoluong;?> </th>
<th id="tt"> <? echo $tongtien; ?> </th>
</tr>
</table>

<table align="center" width="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th scope="col"><a href="home.php?p=booktour"><img src="image/btn_book.gif" title="Booking Online" alt="Booking Online" /></a></th>
  </tr>
</table>
<?php 
	$_SESSION['TenTour']=$tensp; 
	$_SESSION['SoLuong']=$tongsoluong;
?>

<?php } ?>